package cn.fay.chapter18;

import java.nio.ByteBuffer;

public class GetData {

	public static void main(String[] args) {
		ByteBuffer bb=ByteBuffer.allocate(1024);
		int i=0;
		while (i++<bb.limit()) {
			if (bb.get()!=0) {
				System.out.println("no zero");
			}
		}
		System.out.println("i="+i);
		bb.rewind();
		bb.asCharBuffer().put("Howdy!");
		char c;
		while((c=bb.getChar())!=0)
		{
			System.out.print(c+" ");
		}
		System.out.println();
		bb.rewind();
		bb.asShortBuffer().put((short)471142);
		System.out.println(bb.getShort());
		bb.rewind();
		
		
	}

}
